import http from "../../modules/http";

/**
 * 获取股友自选列表
 *  @param {Object} [option]
 * @param {Number} [option.currentPage] - 当前页码
 * @param {Number} [option.pageSize] - 列表长度
 */
export async function getStocks(options) {
  const url = "/client/getStockFriOptionalList.htm";
  const params = { pageSize: 10, currentPage: 1, ...options };
  const res = await http.get(url, { params });
  return res.data;
}

/**
 * 技巧心得列表
 * @param {Object} [option]
 * @param {Number} [option.currentPage] - 当前页码
 * @param {Number} [option.pageSize] - 列表长度
 */
export async function getSkills(options) {
  const url = "/client/skill_experienceList.htm";
  const params = { pageSize: 15, currentPage: 1, ...options };
  const res = await http.get(url, { params });
  return res.data;
}

/**
 * 股友问答列表
 * @param {Object} [option]
 * @param {Number} [option.currentPage] - 当前页码
 * @param {Number} [option.pageSize] - 列表长度
 */
export async function getQuestion(options) {
  const url = "/client/stock_quizList.htm";
  const params = { pageSize: 10, currentPage: 1, ...options };
  const res = await http.get(url, { params });
  return res.data;
}

/**
 * 获取免费录播视频
 * @param {Object} [option]
 * @param {Number} [option.currentPage] - 当前页码
 * @param {Number} [option.pageSize] - 列表长度
 */
export async function getRecordLivelist(options) {
  const url = "/client/queryRecordliveList.htm";
  const params = {
    pageSize: 20,
    currentPage: 1,
    productId: 3,
    ...options,
  };
  const res = await http.get(url, { params });
  return res.data;
}
/**
 * 获取收费录播视频
 * @param <String> productId: 产品ID
 * @return <Promise> Object
 */
export const queryRecordChargeLiveList = async (option) => {
  const url = "/client/queryRecordChargeLiveList.htm";
  const def = {
    currentPage: 1,
    pageSize: 3,
    productId: "",
    ...option,
  };
  const params = Object.assign(def, option);
  const res = await http.get(url, { params });
  return res;
};

/**
 * 获取免费版直播预告
 * @param {Object} [option]
 * @param {Number} [option.currentPage] - 当前页码
 * @param {Number} [option.pageSize] - 列表长度
 */
export async function getMarketLivelist(options) {
  const url = "/client/queryShowYeMarketLiveList.htm";
  const params = { productId: 3, ...options };
  const res = await http.get(url, { params });
  return res.data;
}

/**
 * 获取收费版直播预告
 * @param <String> productId: 产品ID
 * @return <Promise> Object
 */
export const queryShowYeMarketChargeLiveList = async (params) => {
  const url = "/client/queryShowYeMarketChargeLiveList.htm";
  const res = await http.get(url, { params });
  return res;
};
